﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Administrator/Views/Shared/admin.master" Inherits="System.Web.Mvc.ViewPage<CollegeWebsite.Areas.Administrator.Models.Department>" %>
<%@ Import Namespace="CollegeWebsite.Areas.Administrator.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
 <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm()) {%>
        <%= Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Edit departent details</legend>
            <div class="editor-label">
              Department Name:
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.DepartmentName) %>
                <%= Html.ValidationMessageFor(model => model.DepartmentName) %>
            </div>
            
            <div class="editor-label">
             Faculty Name:
            </div>
            <div class="editor-field">
                <%= Html.DropDownListFor(model => model.FacultyID,new SelectList((List<Faculty>)ViewData["faculty"],"FacultyID","FacultyName")) %>
                <%= Html.ValidationMessageFor(model => model.FacultyID) %>
            </div>
            
            <div class="editor-label">
             Department Description:
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.DepartmentDescription, new { @class = "jwysiwyg" })%>
                <%= Html.ValidationMessageFor(model => model.DepartmentDescription) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Status) %>
            </div>
            <div class="editor-field">
                <%= Html.CheckBoxFor(model => model.Status) %><span id="StatusLabel" style="vertical-align: middle">Enable</span>
                
            </div>
            
            <p>
                <input type="submit" value="Save" class="btn-pri"/>
            </p>
        </fieldset>

    <% } %>

    <div>
        <%= Html.ActionLink("Back to List", "Index") %>
    </div>
   <script type="text/javascript">
       $(document).ready(function() {
           if ($('input[id="Status"]').val() == 'true') { $('input[id="Status"]').attr('checked', 'checked'); };
           $('input[id="Status"]').click(function() {
               var state = ($(this).attr('checked')) ? "Enable" : "Disable";
               $('#StatusLabel').text(state);
           });
           $('#StatusLabel').click(function() {
               $('input[id="Status"]').trigger('click');
           });
       });
    </script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="TitleContentPlaceHolder" runat="server">
</asp:Content>


 
